C........................... Pholoel-Freqs.FOR .........................
C:::::::::::::::::::::::::::::::SVOXN2:::::::::::::::::::::::::::::::::::
C.. This routine adjusts the O and N2 photoelectron production frequencies for
C.. solar cycle variation according to the F10.7 index. The factors are based 
C.. on the EUVAC ratios interpolated from unity at F10.7=80 to the EUVAC 
C.. values at F10.7=180
      SUBROUTINE SVOXN2(EE,  !.. Photoelectron energy
     >                F107,  !.. F10.7 index
     >               F107A,  !.. Average F10.7 index
     >                FFOX,  !.. OUT: Factor for multiplying OX frequency
     >                FFN2)  !.. OUT: Factor for multiplying N2 frequency
      IMPLICIT NONE
      INTEGER I,IE   !.. 
      REAL EE,F107,F107A,FFOX,FFN2
      REAL F107AV       !.. Average of F107 and F107A
      REAL FOX_180(901) !.. O factors at F107AV=180
      REAL FN2_180(901) !.. N2 factors at F107AV=180
      REAL A,B          !.. gradient and Abscissa for linear interpolation

      F107AV=(F107+F107A)*0.5  !.. average solar flux
      IE=NINT(EE)              !.. Determine array index

      !.. Interpolate by fitting a straight line between F10.7=80 and 180
      !.. First OX factor
      A=(FOX_180(IE)-1)/100.0  !.. line gradiant
      B=1-A*80.0              !.. line abscissa
      FFOX=A*F107AV+B       !.. find the factor for multiplying frequency
      IF(FFOX.LT.0.8) FFOX=0.8  !.. make sure factor does not get too small

      !.. Now N2 factor
      A=(FN2_180(IE)-1)/100.0  !.. line gradiant
      B=1-A*80.0              !.. line abscissa
      FFN2=A*F107AV+B       !.. find the factor for multiplying frequency
      IF(FFN2.LT.0.8) FFN2=0.8  !.. make sure factor does not get too small
      RETURN

      !.. Photoelectron production frequency multiplicative factors at 
      !.. R=(F107+F107A)/2=180. This corresponds to the April 21, 2002
      !.. for the SEE spectrum. The values are 1 at F10.7=80
      DATA FOX_180/1.52,1.60,1.50,2.00,1.51,1.56,1.83,1.74,1.97,
     > 1.91,1.94,2.28,1.66,1.93,2.46,3.03,2.02,3.03,3.94,2.23,
     > 3.84,1.62,1.68,1.78,3.21,4.47,7.80,1.64,3.42,2.90,6.62,
     > 2.93,3.02,3.06,2.85,2.91,2.89,2.88,2.86,2.90,2.83,2.83,
     > 2.78,2.77,2.69,2.51,2.36,2.48,2.44,2.34,2.35,2.33,2.35,
     > 2.33,2.34,2.32,2.33,2.34,2.33,2.31,2.34,2.31,2.32,2.34,
     > 2.02,186*2.27,650*6.0/
       DATA FN2_180/1.43,1.75,1.38,1.95,1.62,1.48,1.91,2.46,
     > 2.53,2.33,2.75,1.84,2.13,2.56,2.67,2.22,1.84,3.71,2.74,
     > 2.24,5.23,2.31,1.32,1.57,5.03,1.67,6.99,2.75,5.04,3.01,
     > 3.24,2.78,2.86,2.82,2.93,2.77,2.82,2.94,2.94,2.95,2.93,
     > 2.91,2.94,2.83,2.82,2.70,2.38,2.34,2.32,2.34,2.32,2.34,
     > 2.34,2.33,2.34,2.34,2.34,2.29,2.29,2.34,2.23,2.34,2.34,
     > 2.27,2.10,186*2.34,650*6.0/
      RETURN
      END
C::::::::::::::::::::::::::: GET_AUGER ::::::::::::::
C.. Low energy cross sectons and fluxes for Auger electrons
C.. Based on Solomon GLOW model but with the SEE April 21, 2002 fluxes
C.. P. Richards March 2004
      SUBROUTINE GET_AUGER(IDIM,  !.. freq array dimension
     >                     F107,  !.. in: daily 10.7 cm flux index. 
     >                    F107A,  !.. in: 81 day average of daily F10.7 
     >                 AUG_FLUX,  !.. in: Auger fluxes
     >                   PRODOX,  !.. OUT: O production freq
     >                   PRODO2,  !.. OUT: O2 production freq
     >                   PRODN2)  !.. OUT: N2 production freq
      IMPLICIT NONE
      INTEGER IAUG           !.. Number of Auger wavelengths
      PARAMETER (IAUG=8)
      INTEGER I,K            !.. loop control variables
      INTEGER IDIM           !.. freq array dimension
      INTEGER IOXO2P,IN2P    !.. Indices of energy bins for primaries
      INTEGER IDELEV         !.. index for energy bin spread
      REAL F107,F107A        !.. solar indices
      INTEGER AUGE(3)           !.. energy of Auger electrons
      REAL APOTE(3)          !.. Potential energy for Auger electrons
      REAL AFLUXE9(IAUG)     !.. Normalized SEE reference photon flux in
      REAL AUG_FLUX(IAUG)    !.. SEE reference photon flux
      REAL OXAXS(IAUG),O2AXS(IAUG),N2AXS(IAUG)    !.. phoionization cross sections
      REAL WLAUG(IAUG)       !.. Ave, hi, and low wavelengths
      REAL PRODOX(IDIM),PRODO2(IDIM),PRODN2(IDIM)
      REAL DELEV             !.. energy bin spread

      !.. Avakyan et al. give O:474-509, N2: 315-367, O2:456-507 eV
      !.. The O  average and range has have been modified to smooth 
      !.. out the photoelectron spectrum
      DATA AUGE/480,480,340/
      DATA APOTE/533.0,533.0,400.0/   !.. Ionization potential for Augers

      DATA WLAUG/2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5/
      !.. Berkowitz Auger cross sections. Revised 2008-03-07 O=0.5*O2
      DATA OXAXS/.0005,.03,0.15,0.3,0.51,0.0,0.0,0.0/  ! O = 1/2 O2
      DATA O2AXS/.0010,.06,0.30,0.6,1.02,0.0,0.0,0.0/
      !.. Last N2 cross section is reduced because threshold is 31 eV
      DATA N2AXS/.0003,.003,0.2,0.4,0.70,1.2,0.07,0.0/
       
      DO K=1,IDIM
        PRODOX(K)=0.0
        PRODN2(K)=0.0
        PRODO2(K)=0.0
      ENDDO

      DO I=1,IAUG
        AFLUXE9(I)=AUG_FLUX(I)/1.0E9
      ENDDO

      !.. Modified from 25 by PGR 2007-07-05 to better reproduce FAST spectra
      IDELEV=25                   !.. Energy spread of Auger electrons
      DELEV=2.0*REAL(IDELEV)

      !.. First treat N2
      DO I=1,IAUG
        !.. Primary electron has energy of photon E - ionization E
        IN2P=NINT(12397.7/WLAUG(I)-APOTE(3))
        !.. make sure the electrons in array bounds
        IF(IN2P.LT.IDELEV) IN2P=IDELEV+1
        IF(IN2P+IDELEV.GT.800) IN2P=800-IDELEV-1
        DO K=IN2P-IDELEV,IN2P+IDELEV
          PRODN2(K)=PRODN2(K)+ AFLUXE9(I)* N2AXS(I)/DELEV
        ENDDO

        !.. N2 Auger electrons are spread over several bins near 360 eV. 
        !.. See Winningham et al. JGR 1989 page 15338
        DO K=AUGE(3)-IDELEV,AUGE(3)+IDELEV
          PRODN2(K)=PRODN2(K)+ AFLUXE9(I)*N2AXS(I)/DELEV
        ENDDO
      ENDDO

      !.. Now treat O and O2. 
      DO I=1,IAUG-1     !.. Note 35A (360 eV) photons cannot produce Augers 
        !.. Primary electron has energy of photon E - ionization E
        IOXO2P=NINT(12397.7/WLAUG(I)-APOTE(1))
        !.. make sure the electrons in array bounds
        IF(IOXO2P.LT.IDELEV) IOXO2P=IDELEV+1
        IF(IOXO2P+IDELEV.GT.800) IOXO2P=800-IDELEV-1
        DO K=IOXO2P-IDELEV,IOXO2P+IDELEV
          PRODOX(K)=PRODOX(K)+ AFLUXE9(I)*OXAXS(I)/DELEV
          PRODO2(K)=PRODO2(K)+ AFLUXE9(I)*O2AXS(I)/DELEV
        ENDDO

        !.. O and O2 Auger electrons are spread over several bins near 500 eV. 
        !.. See Winningham et al. JGR 1989 page 15338
        DO K=AUGE(1)-IDELEV,AUGE(1)+IDELEV
          PRODOX(K)=PRODOX(K)+ AFLUXE9(I)*OXAXS(I)/DELEV
          PRODO2(K)=PRODO2(K)+ AFLUXE9(I)*O2AXS(I)/DELEV
        ENDDO
      ENDDO

      RETURN
      END
C:::::::::::::::::::::::::::CONVF_EUVAC::::::::::::::::::::::::::::::::::::
C***** This routine has frequencies summed into 1 eV bins using the
C***** F74113 spectrum without summing into 1 eV bins first
C***** EUVAC scaling in place with SEE Auger elecrons
C... This subroutine takes the 1eV resolution production
C... frequencies and converts them to lower resolution using
C... the energy midpoint cell energy E(J) and the energy width
C... DELTE. The required production frequencies are returned in
C... RJOX, RJN2 etc.
C... Primary production frequencies using Fennelly and Torr cross
C... sections for O and N2, older cross sections for O2 and He

      SUBROUTINE CONVF_EUVAC(JMAX,  !.. index of maximum energy
     >                       F107,  !.. Daily F10.7 cm flux
     >                      F107A,  !.. Average F10.7 cm flux
     >                          E,  !.. midpoint energy of bins
     >                      DELTE)  !.. width of energy bins
      IMPLICIT NONE
      INTEGER IMN,IMX                !.. indices of boundaries of energy bins 
      INTEGER I,J,JMAX               !.. I,J are loop control variables
      REAL FFOX,FFN2                 !.. Frequency multipliers for O and N2
      REAL F107,F107A                !.. F10.7 cm flux
      REAL E(201),DELTE(201)         !.. midpoint and width of energy of bins
      REAL RJOX,RJN2,RJO2,RJHE       !.. Arrays for summed frequencies
      REAL UVFAC,EUV                 !.. Photon fluxes
      REAL SJOX(901),SJN2(901),SJO2(901),SJHE(901)   !.. For 1 eV frequencies
      REAL AUG_FLUX(8)                         !.. Auger fluxes
      REAL PRODOX(901),PRODO2(901),PRODN2(901) !..Auger prod freqs

      COMMON/RJS/RJOX(201),RJN2(201),RJO2(201),RJHE(201)
      COMMON/SOL/UVFAC(59),EUV

      !.. add in Auger production
      !.. F74113 Auger fluxes at F10.7=80
      !..DATA AUG_FLUX/3*1.0E+05,   9.00E+06,1.08E+07,2.04E+07,1.0E7/ 
      !.. EUV Fluxes based on Chianti model
      DATA AUG_FLUX/7.67E+03,4.88E+05,6.48E+06,2.80E+07,3.68E+07,
     >   1.07E+07,1.67E+07,0.0E0/
      CALL GET_AUGER(901,F107,F107A,AUG_FLUX,PRODOX,PRODO2,PRODN2)

      !.. Photoelectron frequencies for O2 and He
      CALL SJ_HE_O2(SJO2,SJHE)

      !.. Loop over energy cells and convert to lower resolution
      DO J=1,JMAX
        RJOX(J)=0.0
        RJN2(J)=0.0
        RJO2(J)=0.0
        RJHE(J)=0.0
        !.. Min and Max energy cells to be summed
        IMN=1+E(J)-DELTE(J)*0.5
        IMX=E(J)+DELTE(J)*0.5
        FFOX=1.0
        FFN2=1.0
        !.. SVOXN2 adjusts frequencies for solar variability
        !.. Test to see if need to scale - see DATRD2 subroutine    
      IF(NINT(UVFAC(58)).EQ.-1.OR.NINT(UVFAC(58)).EQ.-3) 
     >   CALL SVOXN2(E(J),F107,F107A,FFOX,FFN2)
        !.. sum frequencies into the energy bins
        DO I=IMN,IMX
          RJOX(J)=RJOX(J)+(SJOX(I)+PRODOX(I))*FFOX/DELTE(J)
          RJN2(J)=RJN2(J)+(SJN2(I)+PRODN2(I))*FFN2/DELTE(J)
          RJO2(J)=RJO2(J)+(SJO2(I)+PRODO2(I))*FFOX/DELTE(J)
          RJHE(J)=RJHE(J)+SJHE(I)*FFOX/DELTE(J)
        ENDDO
      ENDDO
      RETURN

      !.. Photoelectron frequencies using Fennelly and Torr for O and N2
      DATA SJOX/  !.. HEUVAC frequencies
     >  2.35E+01,1.69E+01,2.46E+01,8.24E+00,1.13E+01,7.33E+00,1.15E+01
     > ,7.71E+00,5.53E+00,2.86E+00,1.57E+00,2.05E+00,6.25E+00,1.95E+00
     > ,5.98E-01,2.53E+00,3.41E+00,2.58E+00,1.69E+00,1.03E+00,3.57E+00
     > ,1.56E+01,1.98E+00,2.28E+01,7.20E-01,1.88E+00,1.41E+00,1.54E+01
     > ,1.58E+00,1.93E+00,1.32E+00,3.24E+00,1.72E+00,1.54E+00,3.27E+00
     > ,1.41E+00,8.26E-01,2.00E+00,9.57E-01,9.05E-01,1.06E+00,6.04E-01
     > ,6.63E-01,1.02E+00,1.12E+00,8.35E-01,8.17E-01,1.66E+00,1.24E+00
     > ,9.41E-01,1.32E+00,1.17E+00,1.12E+00,1.15E+00,8.42E-01,1.17E+00
     > ,4.63E-01,5.51E-01,5.79E-01,1.08E-01,1.14E-01,4.55E-02,1.65E-02
     > ,5.52E-02,9.98E-02,2.87E-02,1.13E-01,2.41E-02,4.97E-02,8.42E-02
     > ,1.78E-02,2.35E-02,4.10E-03,1.40E-03,1.75E-02,9.77E-03,5.14E-03
     > ,1.89E-02,1.23E-02,2.99E-03,2.27E-02,9.28E-03,6.71E-03,1.29E-02
     > ,8.61E-03,1.67E-03,6.68E-03,1.34E-02,7.33E-03,1.15E-02,9.39E-03
     > ,8.80E-03,1.57E-02,5.85E-03,1.08E-02,1.13E-02,5.17E-03,1.56E-02
     > ,5.19E-03,1.66E-02,1.71E-02,1.45E-02,2.17E-02,1.34E-02,1.89E-02
     > ,1.64E-02,2.61E-02,1.89E-02,1.31E-02,2.89E-02,2.10E-02,1.30E-02
     > ,2.83E-02,1.91E-02,2.02E-02,1.93E-02,1.68E-02,1.17E-02,2.50E-02
     > ,1.14E-02,1.57E-02,1.61E-02,1.47E-02,1.64E-02,9.08E-03,1.83E-02
     > ,1.08E-02,1.23E-02,1.63E-02,1.78E-02,1.11E-02,2.06E-02,7.38E-03
     > ,1.79E-02,1.01E-02,9.12E-03,1.37E-02,6.62E-03,6.16E-03,5.98E-03
     > ,8.35E-03,4.16E-03,7.07E-03,5.00E-03,7.19E-03,4.72E-03,9.14E-03
     > ,7.79E-03,6.20E-03,5.38E-03,3.79E-03,5.76E-03,4.57E-03,5.20E-03
     > ,3.66E-03,3.32E-03,3.41E-03,5.88E-03,4.71E-03,3.60E-03,2.41E-03
     > ,6.39E-03,1.89E-03,5.22E-04,5.24E-03,9.57E-04,1.12E-03,3.74E-03
     > ,1.72E-03,6.00E-04,4.50E-03,4.13E-03,2.16E-04,3.44E-03,2.79E-03
     > ,1.69E-03,2.62E-03,3.26E-03,2.93E-03,1.78E-03,1.46E-03,2.65E-03
     > ,2.73E-03,2.78E-03,1.73E-03,1.49E-03,4.45E-03,1.15E-03,9.18E-04
     > ,2.09E-03,1.20E-03,8.10E-04,1.80E-04,4.50E-04,3.60E-04,1.24E-03
     > ,1.30E-03,1.38E-03,8.76E-04,1.94E-03,2.31E-03,6.72E-04,1.14E-03
     > ,0.00E+00,1.67E-03,1.54E-03,4.26E-04,2.59E-03,8.64E-04,3.93E-04
     > ,3.06E-03,2.00E-03,3.60E-05,0.00E+00,4.83E-04,1.00E-03,7.20E-04
     > ,9.60E-05,4.92E-04,0.00E+00,7.44E-04,0.00E+00,0.00E+00,8.64E-04
     > ,0.00E+00,8.16E-04,7.20E-04,1.19E-03,1.08E-03,3.60E-05,1.30E-03
     > ,9.18E-04,3.00E-05,5.76E-04,8.64E-04,0.00E+00,0.00E+00,1.92E-04
     > ,1.04E-03,0.00E+00,4.68E-04,3.00E-05,5.76E-04,7.20E-05,0.00E+00
     > ,5.40E-04,3.84E-04,0.00E+00,7.50E-04,0.00E+00,4.50E-04,4.80E-04
     > ,1.26E-04,5.10E-04,2.34E-04,0.00E+00,0.00E+00,9.00E-05,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,2.22E-04,1.80E-04,3.66E-04,0.00E+00
     > ,3.60E-04,3.30E-04,0.00E+00,3.60E-04,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,4.80E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,7.20E-05,1.20E-04,0.00E+00
     > ,0.00E+00,0.00E+00,9.60E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,5.40E-05,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,5.40E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.08E-04,0.00E+00
     > ,1.62E-04,0.00E+00,0.00E+00,1.62E-04,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,3.00E-05,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,2.10E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,3.00E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,2.10E-05
     > ,0.00E+00,0.00E+00,0.00E+00,6.00E-05,0.00E+00,9.00E-05,8.40E-05
     > ,0.00E+00,6.00E-05,4.20E-05,4.20E-05,0.00E+00,0.00E+00,0.00E+00
     > ,4.20E-05,0.00E+00,1.68E-04,2.64E-04,0.00E+00,0.00E+00,0.00E+00
     > ,1.92E-04,0.00E+00,0.00E+00,0.00E+00,0.00E+00,9.60E-05,0.00E+00
     > ,1.92E-04,0.00E+00,0.00E+00,2.16E-04,0.00E+00,4.80E-05,0.00E+00
     > ,0.00E+00,4.80E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,4.50E-05,4.50E-05,0.00E+00,0.00E+00
     > ,0.00E+00,4.50E-05,0.00E+00,1.80E-05,0.00E+00,1.80E-05,0.00E+00
     > ,0.00E+00,1.80E-05,4.50E-05,4.50E-05,0.00E+00,0.00E+00,0.00E+00
     > ,4.50E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,5.40E-05,0.00E+00,5.40E-05
     > ,0.00E+00,0.00E+00,5.40E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,9.00E-06,9.00E-06,0.00E+00,0.00E+00
     > ,0.00E+00,9.00E-06,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.80E-05,0.00E+00
     > ,1.80E-05,0.00E+00,0.00E+00,1.80E-05,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,9.00E-06
     > ,0.00E+00,9.00E-06,0.00E+00,0.00E+00,9.00E-06,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00/
      DATA SJN2/ !..,N2,frequencies,for,FLIP,model
     >  4.95E+01,6.44E+00,3.17E+01,2.39E+01,3.46E+01,2.37E+01,1.19E+01
     > ,5.94E+00,5.53E+00,7.05E+00,1.90E+00,1.48E+01,2.73E+00,3.21E+00
     > ,4.61E+00,4.69E+00,6.36E+00,2.72E+00,8.50E+00,3.40E+00,3.46E+00
     > ,1.04E+01,2.21E+00,4.16E+01,1.32E+00,2.45E+01,2.82E+00,1.68E+00
     > ,3.45E+00,2.47E+00,1.53E+00,6.16E+00,4.13E+00,2.71E+00,3.30E+00
     > ,3.16E+00,1.52E+00,1.45E+00,1.29E+00,6.78E-01,1.13E+00,9.68E-01
     > ,4.11E-01,4.10E-01,1.30E+00,1.01E+00,1.55E+00,1.83E+00,1.10E+00
     > ,1.60E+00,1.35E+00,8.04E-01,1.26E+00,1.14E+00,1.30E+00,1.47E+00
     > ,7.30E-01,2.68E-01,1.22E-01,1.69E-02,5.33E-02,8.28E-02,3.95E-02
     > ,4.58E-02,1.04E-01,7.01E-02,1.67E-01,7.78E-02,4.80E-02,3.07E-02
     > ,5.47E-03,3.54E-02,1.59E-02,0.00E+00,1.04E-02,6.15E-03,4.99E-03
     > ,2.56E-02,2.58E-02,9.87E-03,1.65E-02,1.06E-02,1.89E-02,1.23E-02
     > ,1.61E-02,1.37E-02,1.50E-02,5.54E-03,5.36E-03,2.69E-02,2.36E-02
     > ,8.13E-03,2.97E-02,6.84E-03,1.74E-02,1.30E-02,1.03E-02,1.35E-02
     > ,1.26E-02,1.47E-02,1.29E-02,1.72E-02,3.51E-02,2.11E-02,2.03E-02
     > ,1.76E-02,1.77E-02,2.68E-02,9.00E-03,3.14E-02,2.91E-02,1.98E-02
     > ,2.87E-02,2.24E-02,1.37E-02,1.81E-02,1.76E-02,1.29E-02,1.93E-02
     > ,1.42E-02,1.40E-02,1.08E-02,1.27E-02,1.58E-02,9.63E-03,1.13E-02
     > ,1.65E-02,1.52E-02,1.49E-02,1.66E-02,1.18E-02,1.59E-02,8.84E-03
     > ,1.39E-02,1.14E-02,6.32E-03,4.63E-03,8.86E-03,9.37E-03,3.80E-03
     > ,1.12E-02,3.95E-03,4.33E-03,3.30E-03,7.11E-03,4.48E-03,6.96E-03
     > ,8.42E-03,6.96E-03,6.17E-03,2.84E-03,5.66E-03,1.45E-03,5.37E-03
     > ,5.54E-03,4.76E-03,2.73E-03,3.58E-03,4.55E-03,4.92E-03,2.36E-03
     > ,6.83E-03,3.66E-03,1.68E-03,1.92E-03,3.32E-03,1.19E-03,2.77E-03
     > ,2.35E-03,1.38E-03,3.40E-03,4.64E-03,6.91E-04,2.79E-03,8.79E-04
     > ,1.28E-03,1.50E-03,2.47E-03,2.97E-03,5.61E-03,4.82E-03,1.15E-03
     > ,9.94E-04,2.09E-03,3.38E-03,5.75E-04,6.32E-03,1.21E-03,2.37E-03
     > ,6.43E-04,7.20E-04,2.27E-03,3.10E-04,5.54E-04,3.23E-04,2.46E-04
     > ,2.64E-04,1.49E-03,2.10E-03,2.94E-03,8.11E-04,1.62E-03,1.10E-03
     > ,0.00E+00,6.55E-04,1.05E-03,2.10E-04,4.39E-03,4.25E-03,6.29E-04
     > ,4.06E-04,7.04E-04,1.98E-03,9.12E-04,1.19E-03,2.70E-05,0.00E+00
     > ,1.14E-04,2.74E-04,0.00E+00,8.79E-04,1.33E-03,0.00E+00,0.00E+00
     > ,0.00E+00,3.59E-04,3.59E-04,1.53E-03,3.10E-03,9.35E-04,6.77E-04
     > ,0.00E+00,0.00E+00,2.76E-04,1.23E-04,1.17E-03,6.78E-04,0.00E+00
     > ,0.00E+00,0.00E+00,1.89E-04,0.00E+00,7.98E-04,6.85E-04,1.84E-04
     > ,0.00E+00,6.00E-04,0.00E+00,8.26E-04,3.93E-04,6.34E-04,3.69E-04
     > ,2.85E-05,0.00E+00,1.20E-04,7.00E-05,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,5.09E-05,4.24E-05,2.15E-04,2.81E-04,3.59E-04
     > ,4.31E-04,2.51E-04,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,3.00E-05,0.00E+00,1.27E-04,0.00E+00
     > ,7.37E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,1.94E-04,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,4.49E-05,0.00E+00
     > ,1.90E-04,1.11E-04,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,6.48E-05
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,3.02E-05,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,9.07E-05,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,1.50E-05,0.00E+00,6.34E-05,3.69E-05
     > ,0.00E+00,6.91E-05,6.99E-06,0.00E+00,2.96E-05,1.72E-05,8.64E-06
     > ,0.00E+00,0.00E+00,2.10E-05,0.00E+00,8.87E-05,5.16E-05,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.60E-05,0.00E+00
     > ,6.76E-05,3.93E-05,0.00E+00,2.00E-06,0.00E+00,8.45E-06,4.92E-06
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.62E-05,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,6.48E-06
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.62E-05,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,3.74E-06,0.00E+00,1.58E-05,9.22E-06
     > ,0.00E+00,0.00E+00,0.00E+00,1.50E-06,0.00E+00,6.34E-06,3.69E-06
     > ,0.00E+00,0.00E+00,3.74E-06,0.00E+00,1.58E-05,9.22E-06,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,1.94E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,3.24E-06,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,4.49E-06,0.00E+00,1.90E-05
     > ,1.11E-05,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,7.49E-07,0.00E+00,3.17E-06,0.00E+00,1.84E-06
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,6.48E-06,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,1.50E-06,0.00E+00
     > ,6.34E-06,3.69E-06,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,3.24E-06,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,7.49E-07
     > ,0.00E+00,3.17E-06,1.84E-06,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00
     > ,0.00E+00,0.00E+00,0.00E+00,0.00E+00,0.00E+00/
      END

C::::::::::::::::::::::::::: SJ_HE_O2 ::::::::::::::::::::::::::::::::::::
C.. This subroutine returns the 1eV resolution production
C.. frequencies for O2 and He using Kirby et al cross sections
C.. Written by P. Richards 2004
      SUBROUTINE SJ_HE_O2(SJO2,SJHE)
      IMPLICIT NONE
      INTEGER I,IDIM
      PARAMETER (IDIM=901)
      REAL TJO2(IDIM),TJHE(IDIM),SJO2(IDIM),SJHE(IDIM)
      !.. Primary production frequencies for O2 and He at 1 eV resolution.
      DATA TJO2/157.,75.,51.,31.,14.,15.,7.,19.,8.,17.,10.,3.,3.,1.
     > ,5.,1.,3.,3.,2.,2.,1.,23.,3.,4.,24.,1.,2.,2.,43.,3.,1.3,2.5,4.1
     > ,1.9,1.6,3.0,5.0,1.1,2.3,3.1,1.5,0.8,1.9,0.9,1.5,1.9,1.3,1.1
     > ,1.6,2.9,1.0,2.3,2.6,2.5,1.7,0.8,2.4,1.0,1.4,0.2,1.4,0.5,0.2,0.0
     > ,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.2,0.1,0.1,0.1,26*0.0,800*0.0/
      DATA TJHE/0.8,2.1,0.1,1.0,0.2,0.8,0.0,0.0,2.9,1.3,1.7,0.5,0.0
     > ,0.7,0.7,24.1,0.3,0.4,0.6,0.4,0.6,0.3,0.6,1.9,0.3,0.3,0.5,0.2
     > ,0.1,0.2,0.2,0.1,0.1,0.1,0.0,0.1,0.2,0.0,0.2,0.3,0.2,0.1,0.1
     > ,0.2,0.1,0.2,0.0,0.2,0.1,52*0.0,800*0.0/

      !.. transfer data to return parameters
      DO I=1,IDIM
        SJO2(I)=TJO2(I)
        SJHE(I)=TJHE(I)
      ENDDO
       
      RETURN
      END
